package com.battle.service.controller.web;

import com.battle.pojo.param.questionBankType.*;
import com.battle.pojo.vo.questionBankType.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
*   web/题库分类
* 【描 述】：
* 【环 境】：J2SE
* 【详 细】：
*
*/
@RestController
@RequestMapping("/questionBankType/web")
public class QuestionBankTypeWebController {

private final QuestionBankTypeService service;

public QuestionBankTypeWebController(QuestionBankTypeService service) {
this.service = service;
}


/**
* 创建题库分类
* @param param
* @return
*/
@PostMapping("/createQuestionBankType")
public ApiResult createQuestionBankType(@RequestBody @Valid CreateQuestionBankTypeParam param){
service.createQuestionBankType(param);
return ApiResult.ok();
}


/**
* 修改题库分类
* @param param
*/
@PutMapping("/editQuestionBankType")
public ApiResult editQuestionBankType(@RequestBody @Valid EditQuestionBankTypeParam param){
service.editQuestionBankType(param);
return ApiResult.ok();
}

/**
* 移除题库分类
* @param id
*/
@DeleteMapping("/removeQuestionBankType")
public ApiResult removeQuestionBankType(@RequestParam("id") Long id){
service.removeQuestionBankType(id);
return ApiResult.ok();
}

/**
* 启动/禁用题库分类
* @param id
*/
@GetMapping("/enabledQuestionBankType")
public ApiResult enabledQuestionBankType(@RequestParam("id") Long id){
service.enabledQuestionBankType(id);
return ApiResult.ok();
}

/**
* 获取题库分类详情
* @param id
* @return
*/
@GetMapping("/getQuestionBankType")
public ApiResult< GetQuestionBankTypeVo> getQuestionBankType(@RequestParam("id") Long id){
GetQuestionBankTypeVo vo = service.getQuestionBankType(id);
return ApiResult.ok(vo);
}

/**
* 获取题库分类列表
* @param param
* @return
*/
@PostMapping("/getQuestionBankTypeList")
public ApiResult< PageResult< GetQuestionBankTypeListVo>> getQuestionBankTypeList(@RequestBody GetQuestionBankTypeListParam param){
PageResult< GetQuestionBankTypeListVo> result = service.getQuestionBankTypeList(param);
return ApiResult.ok(result);
}


/**
* 获取题库分类下拉列表
*
* @return
*/
@PostMapping("/getQuestionBankTypeDownList")
public ApiResult< List< GetQuestionBankTypeDownListVo > > getQuestionBankTypeDownList(@RequestBody(required = false) @Valid GetQuestionBankTypeDownListParam param) {
List< GetQuestionBankTypeDownListVo > list = service.getQuestionBankTypeDownList(param);
return ApiResult.ok(list);
}


}

